package com.story.api.moduler.user.validator.impl;

import com.story.api.moduler.user.dao.UserLoginDao;
import com.story.api.moduler.user.validator.IReqValidator;
import com.story.api.moduler.user.validator.dto.Credence;
import com.story.core.util.MD5Util;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author Administrator
 * @decription
 * @Date 2018-01-03 11:31
 */
@Service
public class PhoneValidator implements IReqValidator{

    @Autowired
    private UserLoginDao userLoginDao;

    @Override
    public boolean validate(Credence credence) {
        int count = userLoginDao.userLogin(credence.getCredenceName(), MD5Util.encrypt(credence.getCredenceCode()),credence.getCredenceType());
        if(count > 0) {
            return true;
        }
        return false;
    }
}
